package org.example.leetCode;

import java.util.HashMap;

/**
 * @author Administrator
 */
public class FirstUniqChar {
    public char firstUniqChar(String s) {
        HashMap<Character,Integer> hashMap = new HashMap<>();
        char[] chars = s.toCharArray();
        for (char c:chars){
            hashMap.merge(c,1,Integer::sum);
        }
        for (char c:chars){
            if (hashMap.get(c)==1){
                return c;
            }
        }
        return ' ';
    }
}
